package day02.edu;

import javax.swing.*;

// Created: 09/02/2025, ChangJiang Ru
public class SeasonTest1 {
    public static void main(String[] args) {
        System.out.println(Season1.SPRING);
        System.out.println(Season1.SPRING.getClass());
        System.out.println(Season1.SPRING.getClass().getSuperclass());
        System.out.println(Season1.SUMMER);

        // Case 1: toString()
        System.out.println(Season1.SPRING);
        System.out.println(Season1.SUMMER);
        System.out.println("==========1111");

        // Case 2: name()
        System.out.println(Season1.SUMMER.name());
        System.out.println("==========2222");

        // Case 3: values()
        Season1[] values = Season1.values();
        for (int i = 0; i < values.length; i++) {
            System.out.println(values[i]);
        }
        System.out.println("===========333");

        // Case 4: valueOf(String objName)
        String objName = "AUTUMN";
        System.out.println(Season1.valueOf(objName));
        System.out.println("===========444");

        // Case 5: ordinal()
        System.out.println(Season1.AUTUMN.ordinal());
        System.out.println("===========555");

        // Case 6: show()
        Season1.WINTER.show();
    }
}

interface info
{
    public abstract void show();
}

enum Season1 implements info
{
    SPRING("Spring", "Temperature is warm and flower is open"),
    SUMMER("Summer", "Temperature is hot"),
    AUTUMN("Autumn", "Temperature is cool"),
    WINTER("Winter", "Temperature is cold");

    private final String SeasonName;
    private final String SeasonDescription;

    private Season1(String SeasonName, String SeasonDescription)
    {
        this.SeasonName = SeasonName;
        this.SeasonDescription = SeasonDescription;
    }

    public String getSeasonName()
    {
        return this.SeasonName;
    }
    public String getSeasonDescription()
    {
        return this.SeasonDescription;
    }

    /*
    @Override
    public String toString() {
        return "Season1{" +
                "SeasonName='" + SeasonName + '\'' +
                ", SeasonDescription='" + SeasonDescription + '\'' +
                '}';
    }

     */

    @Override
    public void show()
    {
        System.out.println("SeasonName= " + this.SeasonName + ", SeasonDescription: " + this.SeasonDescription);
    }

}
